package com.ying.controller;


import cn.hutool.core.bean.BeanUtil;
import com.ying.domain.po.Address;
import com.ying.domain.vo.AddressVO;
import com.ying.service.IAddressService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ying
 * @since 2024-09-08
 */
@RestController
@RequestMapping("/address")
@RequiredArgsConstructor
@Api(tags = "地址管理") // 这里的tags属性可以视为类级别的操作分组
public class AddressController {

    private final IAddressService  addressService;

    @ApiOperation("根据id查询地址接口")
    @GetMapping("/{id}")
    public AddressVO getUser(@ApiParam("地址id") @PathVariable("id") Long id) {
        Address address = addressService.getById(id);
        return BeanUtil.copyProperties(address,AddressVO.class);
    }
}
